import psutil
import time
#输出进程的详细信息
# result = psutil.test()
# print("aaa",result,"aaa")

#CUP
# cpu = psutil.cpu_count()
# print("---cpu---")
# print(cpu)

#内存
# memory = psutil.virtual_memory()
# print(memory)

#磁盘
# disk = psutil.disk_partitions()
# print(disk)

#进程
# process = psutil.pids()
# print(process)
# print(len(process))

def monitor(seconds):
    print("CPU  *内存 *   C盘 *  进程数")
    while 1:
        cpu = psutil.cpu_count()#cpu使用率
        memory = psutil.virtual_memory()#内存使用率
        disk = psutil.disk_usage("c:\\")#C盘使用率
        process = psutil.pids()#进程数
        print(str(cpu)+"%   "+str(memory.percent)+"%   "
              +str(disk.percent)+"%    "+str(len(process))
              )
        time.sleep(seconds)

monitor(5)